package oving3;
public class RoyalF {
	public static void createRoyalFamily(){
		Person Harald=new Person("Harald",null,null, 2);
		Person Sonja= new Person("Sonja", null, null, 2);
		Person Martha = new Person("Martha",Sonja, Harald,3);
		Person Haakon = new Person("Haakon",Sonja, Harald, 2);
		Person Ari = new Person("Ari",null, null, 3);
		Person MetteMarit = new Person("Mette-Marit",null,null,2);
		Person LeahIsadora = new Person("LeahIsadora",Martha,Ari,0);
		Person EmmaTalulah = new Person("Emma Talulah",Martha,Ari,0);
		Person SverreMagnus= new Person("Sverre Magnus",Haakon,MetteMarit,0);
		Person IngridAlexandra = new Person("Ingrid Alexandra",Haakon,MetteMarit,0);
		Person MaudAngelica = new Person("Maud Angelica",Martha,Ari,0);
		
		
		Harald.children[0]=Haakon;
		Harald.children[1]=Martha;	
		Sonja.children[0]=Haakon;
		Sonja.children[1]=Martha;
		
		Martha.children[0]=MaudAngelica;
		Martha.children[1]=LeahIsadora;
		Martha.children[2]=EmmaTalulah;
		Ari.children[0]=MaudAngelica;
		Ari.children[1]=LeahIsadora;
		Ari.children[2]=EmmaTalulah;
		
		Haakon.children[0]=IngridAlexandra;
		Haakon.children[1]=SverreMagnus;
		MetteMarit.children[0]=IngridAlexandra;
		MetteMarit.children[1]=SverreMagnus;
		
		print(Harald);
		print(Sonja);
		print(Martha);
		print(Haakon);
		print(Ari);
		print(MetteMarit);
		print(LeahIsadora);
		print(EmmaTalulah);
		print(SverreMagnus);
		print(IngridAlexandra);
		
	}
	public static void main(String[] args){
		createRoyalFamily();
	}
	public static void print(Person p){
		String fa=" ingen registrert far ";
		String mo=" ingen registrert mor ";
		if(!(p.father==null)){
			fa=p.father.name;
		}
		if(!(p.mother==null)){
			mo=p.mother.name;
		}
		String chi="";
		if(p.children.length>0){
			for(int i=0;i<p.children.length;i++){
				chi+=p.children[i].name;
				chi+=" ";
			}
		}
		System.out.println(p.name+" "+fa+" "+mo+" "+chi+" ");
	}
}
